/**
 * Copyright 2022 Huawei Technologies Co., Ltd
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef MINDSPORE_CORE_OPS_IFMR_H_
#define MINDSPORE_CORE_OPS_IFMR_H_
#include <string>
#include <vector>
#include "ops/base_operator.h"

namespace mindspore {
namespace ops {
constexpr auto kNameIFMR = "IFMR";
/// \brief Returns the best quantitative parameters by searching.
/// Refer to Python API @ref mindspore.ops.IFMR for more details.
class MIND_API IFMR : public BaseOperator {
 public:
  MIND_API_BASE_MEMBER(IFMR);
  /// \brief Constructor.
  IFMR() : BaseOperator(kNameIFMR) { InitIOName({"data", "data_min", "data_max", "cumsum"}, {"scale", "offset"}); }
  explicit IFMR(const std::string k_name) : BaseOperator(k_name) {
    InitIOName({"data", "data_min", "data_max", "cumsum"}, {"scale", "offset"});
  }
  /// \brief Init. Refer to the parameters of Python API @ref mindspore.ops.IFMR for the inputs.
  void Init(const float min_percentile = 0.999999, const float max_percentile = 0.999999,
            const std::vector<float> &search_range = {0.7, 1.3}, const float search_step = 0.01,
            const bool with_offset = true);
  /// \brief Set min_percentile.
  void set_min_percentile(const float min_percentile);
  /// \brief Set max_percentile.
  void set_max_percentile(const float max_percentile);
  /// \brief Set search_range.
  void set_search_range(const std::vector<float> &search_range);
  /// \brief Set search_step.
  void set_search_step(const float search_step);
  /// \brief Set with_offset.
  void set_with_offset(const bool with_offset);

  /// \brief Get min_percentile.
  ///
  /// \return min_percentile.
  float get_min_percentile() const;
  /// \brief Get max_percentile.
  ///
  /// \return max_percentile.
  float get_max_percentile() const;
  /// \brief Get search_range.
  ///
  /// \return search_range.
  std::vector<float> get_search_range() const;
  /// \brief Get search_step.
  ///
  /// \return search_step.
  float get_search_step() const;
  /// \brief Get with_offset.
  ///
  /// \return with_offset.
  bool get_with_offset() const;
};
MIND_API abstract::AbstractBasePtr IFMRInfer(const abstract::AnalysisEnginePtr &, const PrimitivePtr &primitive,
                                             const std::vector<abstract::AbstractBasePtr> &input_args);
}  // namespace ops
}  // namespace mindspore
#endif  // MINDSPORE_CORE_OPS_IFMR_H_
